load("//bazel:macros.bzl", "exports_files_legacy", "skia_cc_deps", "split_srcs_and_hdrs")

licenses(["notice"])

exports_files_legacy()

DAWN_FILES = [
    "GrDawnAsyncWait.cpp",
    "GrDawnAsyncWait.h",
    "GrDawnAttachment.cpp",
    "GrDawnAttachment.h",
    "GrDawnBuffer.cpp",
    "GrDawnBuffer.h",
    "GrDawnCaps.cpp",
    "GrDawnCaps.h",
    "GrDawnGpu.cpp",
    "GrDawnGpu.h",
    "GrDawnOpsRenderPass.cpp",
    "GrDawnOpsRenderPass.h",
    "GrDawnProgramBuilder.cpp",
    "GrDawnProgramBuilder.h",
    "GrDawnProgramDataManager.cpp",
    "GrDawnProgramDataManager.h",
    "GrDawnRenderTarget.cpp",
    "GrDawnRenderTarget.h",
    "GrDawnRingBuffer.cpp",
    "GrDawnRingBuffer.h",
    "GrDawnTexture.cpp",
    "GrDawnTexture.h",
    "GrDawnTextureRenderTarget.cpp",
    "GrDawnTextureRenderTarget.h",
    "GrDawnTypesPriv.cpp",
    "GrDawnUtil.cpp",
    "GrDawnUtil.h",
]

split_srcs_and_hdrs(
    name = "dawn",
    files = DAWN_FILES,
)

filegroup(
    name = "srcs",
    srcs = [":dawn_srcs"],
    visibility = ["//src/gpu/ganesh:__pkg__"],
)

filegroup(
    name = "private_hdrs",
    srcs = [":dawn_hdrs"],
    visibility = ["//src/gpu/ganesh:__pkg__"],
)

skia_cc_deps(
    name = "deps",
    visibility = ["//src/gpu/ganesh:__pkg__"],
    deps = select({
        # Dawn headers and symbols are provided by Emscripten in a WASM build. We depend on Dawn
        # only for native.
        "//bazel/common_config_settings:cpu_wasm": [],
        "//conditions:default": ["@dawn"],
    }),
)
